<template>
   登录页
   <div>
    账号： <input type="text" v-model="account" placeholder="账号">
   </div>
   <div>
    密码 <input type="password" v-model="password" placeholder="密码">
   </div>
   <div>
    <button @click="submit">登录</button>
   </div>

   {{ account }}
   {{ password }}
</template>

<script setup>
import router from "@/router";
import { ref } from "vue";
import { useStore } from "vuex";

const store = useStore
const account = ref('')
const password = ref('')

const submit = ()=>{
    if (account.value === 'admin' && password.value === '123456') {
        alert("登录成功")

        store.commit("updateUserInfo",{
            name:'li',
            gender:'男',
            phone:'11111111'
        })

        router.push({path:'/user'})
    } else {
        alert("账号密码错误，请重新登录")
    }
}
</script>@/routers